#pragma once

#include "Game/Process/RenderProcess.h"
#include "Render/Texture/Picture2DTexture.h"
#include "Render/Texture/RenderTarget.h"
#include "Render/Tradition/RHIRenderPass.h"
#include "Render/Tradition/GraphicsPipeline.h"
#include "Render/Texture/ColorRenderTarget.h"
#include "Render/Texture/CubemapTexture.h"
#include "Render/Texture/DepthRenderTarget.h"
#include "Render/Shader/RHIDescriptor.h"
#include "Render/Tradition/RHIFramebuffer.h"
#include "LocalEntity.h"


class PbrProcess : public RenderProcess
{
	DECLARE_PROCESS(PbrProcess)

	struct Ubo
	{
		glm::mat4 proj;
		glm::mat4 model;
		glm::mat4 view;
		glm::vec4 camera;
	};

	struct LightUbo {
		glm::vec4 lights[4];
		glm::vec4 colors[4];
		float exposure;
		float gamma;
		int32 mWatchMode;
	};

protected:

	virtual void OnInit() override;

	virtual void OnTick(float deltaTime) override;

	virtual void OnResize() override;

public:

	float mExposure;

	float mGamma;

	int32 mWatchMode;

	std::vector<LocalEntity*> mLightEntitys;

protected:

	RefCountPtr<VertexBuffer> mVertexBuffer;

	RefCountPtr<IndexBuffer> mIndexBuffer;

	RefCountPtr<RHIBuffer> mUboBuffer;
	
	RefCountPtr<RHIBuffer> mLightBuffer;



	RefCountPtr<RHITexture> mAlbedoTexture;

	RefCountPtr<RHITexture> mNormalTexture;

	RefCountPtr<RHITexture> mMetallicTexture;

	RefCountPtr<RHITexture> mRoughnessTexture;


	RefCountPtr<RHISampler> mPbrSampler;


	RefCountPtr<RHIDescriptor> mDescriptor;

	DescriptorMask mDescriptorMask;

	RefCountPtr<GraphicsPipeline> mPipeline;
};
